﻿@{
    ViewBag.Title = "list";
    Layout = "~/Views/Shared/_webLayout.cshtml";
}

    <div class="wrapper wrapper-content  animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox ">
                    <div class="ibox-title">
                        <h5>操作日志</h5>
                      
                    </div>
                    <div class="ibox-content">
                        <form role="form" class="form-inline" id="formSearch" name="formSearch">
                            <div class="form-group">
                                <label for="exampleInputEmail2" class="sr-only">关键字</label>
                                <input type="email" placeholder="请输入关键字" id="keyword" name="keyword" class="form-control">
                            </div>
                            <button class="btn btn-white" type="button" id="btnsearch">查询</button>
                            <button class="btn btn-success" type="button" onclick="add()"><i class="fa fa-plus"></i>&nbsp;&nbsp;<span class="bold">添加</span></button>
                            <button class="btn btn-success" type="button" onclick="addopen()"><i class="fa fa-plus"></i>&nbsp;&nbsp;<span class="bold">添加(单独)</span></button>
                            <button class="btn btn-primary" type="button" id="btndelete"><i class="fa fa-remove"></i>&nbsp;&nbsp;<span class="bold">删除选中</span></button>
                            <button class="btn btn-primary" type="button" id="btndelete"><i class="fa fa-sign-out"></i>&nbsp;&nbsp;<span class="bold">导出</span></button>
                          
                        </form>
                    </div>
                    <div class="ibox-content">
                        <div class="jqGrid_wrapper">
                            <table id="table_list_1"></table>
                            <div id="pager_list_1"></div>
                        </div>
                        <p>&nbsp;</p>

                    </div>
                </div>
            </div>
        </div>
    </div>

  
    <!-- jqGrid -->
    <script src="/Skin/H4.2/js/plugins/jqgrid/i18n/grid.locale-cn.js?0820"></script>
    <script src="/Skin/H4.2/js/plugins/jqgrid/jquery.jqGrid.min.js?0820"></script>

    <script>
        $(document).ready(function () {

            $("#btnsearch").click(function () {
                $("#table_list_1").jqGrid('setGridParam', {
                    postData: $('#formSearch').serializeObject(),
                    page: 1
                }).trigger("reloadGrid"); //重新载入
            });
            var jsonuserinfo = $('#form1').serializeObject();

            $.jgrid.defaults.styleUI = 'Bootstrap';
            $("#table_list_1").jqGrid({
                url: '/Operate/List',
                datatype: "json",
                mtype: 'POST',
                height: 'auto',
                autowidth: true,
                shrinkToFit: true,
                multiselect: true,
                multiboxonly: true,
                postData: $('#formSearch').serializeObject(),
                cellEdit: true,
                rowNum: 10,
                rowList: [10, 20, 30],
                rownumbers :true,
                colNames: ['编号', '操作类型', '操作内容', '操作者名称', 'IP地址', '操作时间','操作'],
                colModel: [
                    {
                        name: 'P_ID',
                        index: 'P_ID',
                        width: '10%',

                    },
                    {
                        name: 'Op_Type',
                        index: 'Op_Type',
                        width: '15%',
                    },
                    {
                        name: 'Op_Msg',
                        index: 'Op_Msg',
                        width: '20%',
                    },
                    {
                        name: 'LoginName',
                        index: 'LoginName',
                        width: '15%',
                    },
                    {
                        name: 'Opt_IP',
                        index: 'Opt_IP',
                        width: '20%',
                    },
                    {
                        name: 'Op_Time',
                        index: 'Op_Time',
                        width: '20%',
                    }, 
                     {
                         label: '编辑', name: 'id', index: 'id', width: 100, align: 'center',
                         formatter: function (cellvalue, options, rowObject) {
                             // return "<a data-toggle='modal' href='splistadd?id=" + cellvalue + "' data-target='#mmXgmodal'>编辑</a> | <a href='javascript:splistdelete(" + cellvalue + ")'>删除</a> ";
                             return "<a data-toggle='modal' href='javascript:myedit(" + cellvalue + ")'>编辑</a> | <a href='javascript:mydelete(" + cellvalue + ")'>删除</a> ";

                         },
                     },
                ],
                jsonReader: {
                    root: "List",
                    page: "page",
                    total: "total",
                    records: "records",
                    repeatitems: false,
                },
                pager: "#pager_list_1",
                viewrecords: true,
                hidegrid: false
            });
            // Add responsive to jqGrid
            $(window).bind('resize', function () {
                var width = $('.jqGrid_wrapper').width();
                $('#table_list_1').setGridWidth(width);
            });
            $('#mmXgmodal').on('hidden.bs.modal', function () {
                $(this).removeData('bs.modal');
            });

        });

    </script>

    <div class="modal fade" id="mmXgmodal" tabindex="-1" role="dialog" aria-labelledby="modal">
        <div class="modal-dialog" role="document">
            <div class="modal-content  animated bounceInRight">

            </div>
        </div>
    </div>

